﻿// Decompiled with JetBrains decompiler
// Type: SeninServisin3._5.Service1
// Assembly: SeninServisin3.5, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: CEE1A348-535E-4B91-8EE1-A3543AFAEA6A
// Assembly location: G:\Projects\CSharp\RamazandanGelenler\SeninServisin3.5\bin\SeninServisin3.5.dll

using System;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;
using System.Web.Services;

namespace SeninServisin3._5
{
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [WebService(Namespace = "http://tempuri.org/")]
    public class Service1 : WebService
    {
        private string web_Service_UserName = "62ed150afc369c0695f97af6d9dfd202";
        private string web_Service_UserPassWord = "26afafdafc2321a771e3ba96d1764f98";

        [WebMethod]
        public DataSet GetTechnicalServiceStatus(string WebServiceUserName, string WebServiceUserPassWord, string SeriNo, int FormNo, string MusteriFormNo)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                if (FormNo > 0)
                    selectCommand.CommandText = string.Format("exec sp_TeknikServisDurum2 {0},NULL,NULL,NULL,NULL,NULL,NULL,NULL,1", (object)FormNo);
                else if (!string.IsNullOrEmpty(SeriNo))
                    selectCommand.CommandText = string.Format("exec sp_TeknikServisDurum2 NULL,'{0}',NULL,NULL,NULL,NULL,NULL,NULL,1", (object)SeriNo);
                else if (!string.IsNullOrEmpty(MusteriFormNo))
                    selectCommand.CommandText = string.Format("exec sp_TeknikServisDurum2 NULL,NULL,NULL,NULL,NULL,'{0}',NULL,NULL,1", (object)MusteriFormNo);
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }

        [WebMethod]
        public DataSet GetInstitutionalTechnicalServiceStatus(string WebServiceUserName, string WebServiceUserPassWord, string CustomerCode, DateTime StartDate_, DateTime EndDate_)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                selectCommand.CommandText = string.Format("DECLARE @dt1 DATETIME DECLARE @dt2 DATETIME SET @dt1 = cONVERT(DATETIME,'{0}') SET @dt2 = cONVERT(DATETIME,'{1}') \r\nexec sp_TeknikServisDurum2 NULL,NULL,NULL,NULL,'{2}',NULL,@dt1,@dt2,100000", (object)StartDate_.ToString("yyyy-MM-dd"), (object)EndDate_.ToString("yyyy-MM-dd"), (object)CustomerCode);
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }

        [WebMethod]
        public DataSet GetUserList(string WebServiceUserName, string WebServiceUserPassWord)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                selectCommand.CommandText = "SELECT * FROM [dbo].[SeninServisin_Kullanicilar]";
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }

        [WebMethod]
        public DataSet LoginUser(string WebServiceUserName, string WebServiceUserPassWord, string UserName, string Password)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                selectCommand.CommandText = string.Format("select * from  [dbo].[SeninServisin_Kullanicilar] where UserName = '{0}' and UserPassWord = '{1}' ", (object)UserName, (object)Password);
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }

        [WebMethod]
        public DataSet AddUser(string WebServiceUserName, string WebServiceUserPassWord, string UserName, string UserPassword, string AccountName, string AccountCode, string Role)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                selectCommand.CommandText = string.Format("INSERT INTO [dbo].[SeninServisin_Kullanicilar] (UserName, UserPassword, AccountName, AccountCode, Role)\r\nVALUES ('{0}','{1}','{2}','{3}','{4}');", (object)UserName, (object)UserPassword, (object)AccountName, (object)AccountCode, (object)Role);
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }

        public DataSet LoginUser(string WebServiceUserName, string WebServiceUserPassWord, int UserID, string UserName, string UserPassword, string AccountName, string AccountCode, string Role)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                selectCommand.CommandText = string.Format("UPDATE [dbo].[SeninServisin_Kullanicilar] SET UserName='{0}', UserPassword='{1}', AccountName='{2}', AccountCode='{3}', Role='{4}'  WHERE ID={5};", (object)UserName, (object)UserPassword, (object)AccountName, (object)AccountCode, (object)Role, (object)UserID);
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }

        [WebMethod]
        public DataSet DeleteUser(string WebServiceUserName, string WebServiceUserPassWord, int UserID)
        {
            try
            {
                if (!(WebServiceUserName == this.web_Service_UserName) || !(WebServiceUserPassWord == this.web_Service_UserPassWord))
                    throw new Exception("Yetkisiz Erişim");
                DataSet dataSet = new DataSet();
                OleDbConnection oleDbConnection = new OleDbConnection("Provider=SQLOLEDB.1;Password=klm2013*;Persist Security Info=True;User ID=klm;Initial Catalog=Data29;Data Source=20.10.2.11;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Application Name=CasperPrg;Workstation ID=MURATB;Use Encryption for Data=False;Tag with column collation when possible=False");
                OleDbCommand selectCommand = new OleDbCommand();
                selectCommand.CommandType = CommandType.Text;
                selectCommand.CommandText = string.Format("DELETE FROM [dbo].[SeninServisin_Kullanicilar] WHERE ID={0};", (object)UserID);
                selectCommand.Connection = oleDbConnection;
                try
                {
                    oleDbConnection.Open();
                    ((DataAdapter)new OleDbDataAdapter(selectCommand)).Fill(dataSet);
                    return dataSet;
                }
                catch (Exception ex)
                {
                    return dataSet;
                }
                finally
                {
                    oleDbConnection.Close();
                    oleDbConnection.Dispose();
                }
            }
            catch (Exception ex)
            {
                return (DataSet)null;
            }
        }
    }
}
